import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class Event{
	
	private String name;
	private String location;
	private ArrayList<Incident> incidents;
	
	public Event(){
		name = null;
		location = null;
		incidents = new ArrayList<Incident>();
	}

	public Event(String name, String location, ArrayList<Incident> incidents) {
		this.name = name;
		this.location = location;
		this.incidents = incidents;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getLocation() {
		return location;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	public ArrayList<Incident> getIncidents() {
		return incidents;
	}

	public void setIncidents(ArrayList<Incident> incidents) {
		this.incidents = incidents;
	}
	
	public void addIncident(Incident a){
		incidents.add(a);
	}
	
	public String toString(){
		
		String eventString = "------------------\n";

		eventString += "Event Name: " + name + "\n";
		eventString += "Event Location: " + location + "\n";
		
		for(Incident a : incidents){
			eventString += "\nIncident " + (a.getNumber()) +"\n";
			eventString += a.toString();
			eventString += "\n";
		}
		
		eventString += "-------------------";
		return eventString;
		
	}
	
public String fullToString(){
		
		String eventString = "------------------\n";

		eventString += "Event Name: " + name + "\n";
		eventString += "Event Location: " + location + "\n";
		
		for(Incident a : incidents){
			eventString += "\nIncident " + (a.getNumber()) +"\n";
			eventString += a.fullToString();
			eventString += "\n";
		}
		
		eventString += "-------------------";
		return eventString;
		
	}
	
	public String liteToString(){
		return "Event Name: "+name;
	}
	
	public String rpnToString(){
		String eventString = "------------------\n";

		eventString += "Event Name: " + name + "\n";
		eventString += "Event Location: " + location + "\n";
		
		for(Incident i : incidents){
			eventString += "\nIncident " + (i.getNumber()) +"\n";
			eventString += "Incident RPN: "+i.getRpn();
			eventString += "\n";
		}
		
		eventString += "-------------------";
		return eventString;
	}
	
	public void sortIncidents(){
		Collections.sort(incidents,new Comparator<Incident>(){
			public int compare(Incident i1, Incident i2){
				return i2.getRpn() - i1.getRpn();
			}
		});
	}
}